package mybatis.generator;

import lombok.Data;

import java.util.Date;

/**
 * @author wujian
 * @date 2018年6月24日 下午5:35:14
 */
@Data
public class BaseModel {
    /**
     * 主键
     */
    private Integer id;
    /**
     *创建用户
     */
    private Integer createUser;

    /**
     * 创建日期
     */
    private Date createDate;

    /**
     *修改用户
     */
    private Integer modifyUser;

    /**
     * 修改日期
     */
    private Date modifyDate;

    /**
     * 是否已删除(1:是，0否)
     */
    private Integer isDelete;

    public void setBase(){
        setBase(0);
    }
    public void setBase(Integer userId){
        userId = userId==null?0:userId;
        this.modifyUser = userId;
        this.modifyDate = new Date();
        this.isDelete = 0;
        if(null==id){
            this.createUser = userId;
            this.createDate = new Date();
        }
    }
}

